#include "Advisor.h"
#include"Player.h"
#include"Table.h"

//UNTESTED

//Later Advisor will use the context of the table to make a decision
//For now these are barebones decisions

Advisor::Advisor(Table* t, Player* p)
{
  context = t;
  player = p;
}

Card* Advisor::whichCard(){
  assert(player != NULL);
  assert(player->getHand()->size());
  Deck tempHand = *player->getHand();
  tempHand.sort();
  return tempHand.at(tempHand.size()-1);
}

int Advisor::feedHowMuch(Player* hungryVassal)
{
  if ((hungryVassal->getArmy()->size()<5) && player->getArmy()->size()>10)
  {
    return 4;//4 cards if you can
  }
  else
  {
    return 0;//else none
  }
}

vector<Player*> Advisor::feedWho()
{
 vector<Player*> tempList;
  for(int i = 0; i < player->getVassals().size() - 1; i++){
    //for now just feed all the vassals owned with a deck of less than 6
    if (player->getVassals().at(i)->getArmy()->size() < 6){
      tempList.push_back(player->getVassals().at(i));
    }
  }
  return tempList;
}

